﻿using Common.Common;
using System;

using WSLibrary;
using System.ServiceModel;
using System.Threading;

namespace DCPWebServer
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                // web
               // LogHelper.Info("Start.");

                //启动WCF服务
                ServiceHost host = new ServiceHost(typeof(WCFLibrary.BluetoothService));
                host.Open();

                //初始化db
                DBLibrary.AppDbContext.Initialize();

                //启动WebApiServer
                Thread HTTPThread = new Thread(ApiServer.InitApiServer);
                HTTPThread.Start();

                Console.WriteLine("The DCP service has been started. Press Enter key to terminate the service!");

                Thread WSThread = new Thread(WSConfig.Start);
                WSThread.Start();

                Console.ReadLine();
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
    }
}
